import { handleAuthGetUserInfo, handleGetUserPhomeNumber } from '../../utils/wx'
import { isLogin, toLogin, getUserInfo, clearCacheAll } from '../../utils/auth'
import http from '../../utils/http'
import { showModel, showNotify, showToast, showDialog } from '../../utils/index'
Page({

    /**
     * 页面的初始数据
     */
    data: {
        userInfo: null,
        dataListMemberCoupon: null
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {
        // 用户登录信息
        this.setData({ userInfo: getUserInfo() });
        this.getDataListMemberCoupon()
    },

    /**
     * 获取我的优惠券
     */
    async getDataListMemberCoupon() {
        let { userInfo } = this.data
        console.log(userInfo);
        let res = await http.get('/api/mall/umsmember/getUserCoupons/'+userInfo.id)
        console.log(res);
        if (res.status) {
            console.log(res.data);
            this.setData({ dataListMemberCoupon: res.data })
        }
    },
    
})